{* Модуль редактирования услуги телефонной связи *}

<script type="text/javascript">
<!--{literal}
$(document).ready
(
    function()
    {
	$('div.dialog#service').dialog
	(
	    'option',
	    {
		title:	'Добавить услугу',
		width:	640,
		resizable:	false,
		buttons:
		{
		    'Сохранить':	function(){$(this).find('form').submit();}
		}
	    }
	);

	$('a#service-add').click(function(){$('div.dialog#service').dialog('open');});

	$('select#service-name-id').change
	(
	    function()
	    {
		$('.service-options:visible').hide();

		switch( $(this).val() )
		{
		    case '3':
			$('.service-options#service-name-3').show();
			break;
		}
	    }
	);
    }
);
{/literal}-->
</script>

<!-- Добавление услуги -->
<div class="dialog" id="service">
    <form action="db.php" method="post">
	<input type="hidden" name="action" value="service.new.do"/>
	<input type="hidden" name="account_id" value="{$customer.account_id}"/>
	<table class="ui-widget" cellspacing="0" width="100%">
	    <tr>
		<td align="right">Услуга:</td>
		<td>
		    <select name="service_name" id="service-name-id">
		    {foreach from=$service_names item=sn}
			<option value="{$sn.id}">{$sn.service_name}</option>
		    {foreachelse}
			<option class="ui-state-disabled" value="">Нет доступных услуг</option>
		    {/foreach}
		    </select>

		    <table class="service-options ui-state-default" id="service-name-3" style="display:none;">
			<tr>
			    <td align="right"><strong>Номер телефона:</strong></td>
			    <td><input type="text" name="phone_number"/></td>
			</tr>
			<tr>
			    <td align="right"><strong>Тариф:</strong></td>
			    <td>
				<select name="phone_rate_id">
				{foreach from=$phone_rates item=rate}
				    <option value="{$rate.id}">{$rate.rate_name}</option>
				{/foreach}
				</select>
			    </td>
			</tr>
		    </table>
		</td>
	    </tr>
	    <tr>
		<td align="right">Исполнитель:</td>
		<td>
		    <select name="executive">
		    {foreach from=$executives item=executive}
			<option value="{$executive.id}">{$executive.executive_name}</option>
		    {foreachelse}
			<option class="ui-state-disabled" value="">Нет доступных исполнителей</option>
		    {/foreach}
		    </select>
		</td>
	    </tr>
	    <tr>
		<td align="right">Стоимость:</td>
		<td><input type="text" name="cost" value="0.00"/></td>
	    </tr>
	    <tr>
		<td align="right">Ежемесячная:</td>
		<td><input type="checkbox" name="monthly"/></td>
	    </tr>
	    <tr>
		<td align="right">Начало:</td>
		<td><input type="text" name="start_date" class="date"/></td>
	    </tr>
	    <tr>
		<td align="right">Конец:</td>
		<td><input type="text" name="stop_date" class="date"/></td>
	    </tr>
	</table>
    </form>
</div>
